﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HuntWump2
{
    class PlayerObject
    {
        //number of turns, arrows, coins, and secrets here

        //PlayerObject is a class of a lot of get/sets, make it happen
        //this class is also the class in which score is calculated
        //based on a myriad of variables. Method is found towards 
        //the bottom

        public static int numOfTurns = 1;
        public static int numOfArrows = 3;
        public static int numOfCoins = 5; //not final
        private static int numOfSecrets;
        public static int numOfCoinsCollected = 0;

        public int temp;
		
        //prices of arrows and secrets here
        private const int PRICE_OF_ARROW = 2;
        private const int PRICE_OF_SECRET = 5;
		public static String userName;

//***********************ARROWS***********************
        public int ArrowCounter(int numOfArrows)
        {
            //keep track of arrows
            return numOfArrows;
        }

        public int ShootArrow(int numOfArrows)
        {
            numOfArrows--;
            return numOfArrows;
        }

        public int GainArrow(int numOfArrows, int numOfArrowsPurchased, int numOfCoins)
        {
            //pretty logical
            if(numOfCoins >= (numOfArrows * numOfArrowsPurchased))
            {
                numOfCoins -= (PRICE_OF_ARROW * numOfArrowsPurchased);
                numOfArrows += numOfArrowsPurchased;
                return numOfArrows;
            }
            else
            {
                return 0;
            }
        }

//*******************COINS*************************

        public int CoinCounter(int numOfCoins)
        {
            //keep track of number of coins (coins collected and coins spent)
            return numOfCoins;
        }

        //use recursive methods for SpendCoin and GainCoin methods
        public int SpendCoin(int numOfCoins, int numCoinsSpent)
        {
            if (numOfCoins == 0)
            {
                //break for the time being?
                return 0;
            }
            //buying arrows
            else if(numOfCoins == 50)//needs actual condition
            {
                return numOfCoins - PRICE_OF_ARROW;
            }
            else if (numOfCoins == 30)//needs actual condition
            {
                return numOfCoins - PRICE_OF_SECRET;
            }
            else
            {
                return -1;
            }
        }

        public int GainCoin(int numOfCoins, int numCoinsGained)
        {
            //basecase
            if (numCoinsGained == 0)
            {
                return numOfCoins;
            }
            else
            {
                return (numOfCoins + (numCoinsGained - 1) + 1);
            }
        }

//********************TURNS*******************
 
        public int TurnCounter(int numOfTurns)
        {
            //keep track of number of turns the player has taken
            return numOfTurns;
        }

        //not the dessert...nor is it football or basketball
        public int TurnOver(int numOfTurns)
        {
            //figure out how to count turns
            numOfTurns++;
            return numOfTurns;
        }

//****************SECRETS*******************

        public int SecretCounter(int numOfSecrets)
        {
            //keep track of number of secrets purchased 
            return numOfSecrets;
        }

        public int BuySecret(int numOfSecrets)
        {
            //don't forget to spend money? 
            //for the time being, let's 
            //sell a secret for one coin
            numOfCoins -= PRICE_OF_SECRET;
            numOfSecrets++;
            return numOfSecrets;
        }

//*****************NAME**********************
        public String GetName()
        {
            return userName;
        }
//**************SCOREKEEPING*****************
        public static int KeepScore(int numOfTurns, int numOfCoins, int NumOfArrows)
        {
            //calculate score
            int score = 100 - numOfTurns + numOfCoins + (10 * numOfArrows);
            return score;
        }


    }
}
